package com.easy.activiti.ext;

import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;

/**
 * @author zhouchuang
 * 2024-11-04 21:57:45
 */
public class GlobalTaskListener implements TaskListener {
    @Override
    public void notify(DelegateTask delegateTask) {
        System.out.println("========================GlobalTaskListener========================");
        System.out.println("delegateTask.getProcessDefinitionId() = " + delegateTask.getProcessDefinitionId());
        System.out.println("delegateTask.getFormKey() = " + delegateTask.getFormKey());
        System.out.println("delegateTask.getProcessInstanceId() = " + delegateTask.getProcessInstanceId());
        System.out.println("delegateTask.getTaskDefinitionKey() = " + delegateTask.getTaskDefinitionKey());
        System.out.println("delegateTask.getEventName() = " + delegateTask.getEventName());
        System.out.println("delegateTask.getName() = " + delegateTask.getName());
        System.out.println("delegateTask.getAssignee() = " + delegateTask.getAssignee());
        System.out.println("delegateTask.getVariables() = " + delegateTask.getVariables());

        String ProcessDefinitionId = delegateTask.getProcessDefinitionId();
        String processDefinitionKey = ProcessDefinitionId.split(":")[0];

//        create：创建事件
//        assignment：指派事件
//        complete：完成事件
//        delete：删除事件
        String eventName = delegateTask.getEventName();
        String taskName = delegateTask.getName();

    }
}
